using System;
using System.Collections.Generic;
using System.Text;

namespace CGMSharp.Types
{
    class CI : AbstractType
    {
        private int val;
	
        public override int ReadFromStream(System.IO.Stream s)
        {
            val = BinaryUtil.ReadUI(s, Configuration.ColorIndexPrecision);
            return Configuration.ColorIndexPrecision;
        }

        public override int WriteToStream(System.IO.Stream s)
        {
            BinaryUtil.WriteUI(s, Configuration.ColorIndexPrecision, val);
            return Configuration.ColorIndexPrecision;
        }

        public override int Octets()
        {
            return Configuration.ColorIndexPrecision / 8;
        }

        public override string ToString()
        {
            return "CI";
        }

        public int Val
        {
            get { return val; }
            set { val = value; }
        }
    }
}
